package demo1104.demo01;

import java.security.PublicKey;
import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/4 16:13
 */
public class TestConstruct {
    public static void main(String[] args) {
        //Supplier<Person> supplier = ()->new Person();
        Supplier<Person> supplier =Person::new;
        Person person = supplier.get();
        System.out.println(person);

        //Function<Integer,Person> function = i->new Person(i);
        Function<Integer,Person> function = Person::new;
        Person person1 = function.apply(20);
        System.out.println(person1);

    }
}
class Person{
    private int age;

    public Person(int age) {
        this.age = age;
    }

    public Person() {
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                '}';
    }
}